<!DOCTYPE html>
<html>
<head>
    <title>模具换件记录</title>
    #parse("sys/header.html")
</head>
<style>
    ::-webkit-scrollbar{
        width: 10px;
        height: 10px;
    }
    ::-webkit-scrollbar-thumb{
        border-radius: 10px;
        -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
        background: #a8a5a5;
    }
</style>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList" style="padding: 5px">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="4">
                    <i-input v-model="q.moduleNo" @on-enter="query" placeholder="模具号"></i-input>
                </i-col>
                <i-col span="4">
                    <i-input v-model="q.name" @on-enter="query" placeholder="备件名称"></i-input>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">
                #if($shiro.hasPermission("modulereplacepart:review"))
                <i-button type="primary" @click="deptCheck"><i class="fa fa-gavel"></i>&nbsp;审核</i-button>
                #end
                #if($shiro.hasPermission("modulereplacepart:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("modulereplacepart:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("modulereplacepart:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
        <table id="jqGrid"></table>
    </div>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="moduleReplacePart" :rules="ruleValidate" :label-width="80">
            <Row>
                <i-col span="11">
                    <Form-item label="换件类别" prop="typeMethod">
                        <i-select v-model="moduleReplacePart.typeMethod" placeholder="请选择换件类别" @on-change="resetForm">
                            <i-option v-for="moldTicketType in moldTicketTypeList" :value="moldTicketType.value" :key="moldTicketType.value">{{moldTicketType.name}}</i-option>
                        </i-select>
                    </Form-item>
                </i-col>
                <i-col span="11" offset="2">
                    <Form-item :label="(moduleReplacePart.typeMethod==3?'模具':'工单') + '编码'" prop="replaceCode">
                        <i-input v-model="moduleReplacePart.replaceCode" icon="md-arrow-dropdown-circle" @on-click="getModuleArchives" readonly placeholder="请选择编号"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="模具号" prop="moduleNo">
                        <i-input v-model="moduleReplacePart.moduleNo" readonly placeholder="模具号"></i-input>
                    </Form-item>
                </i-col>
                <i-col span="11" offset="2">
                    <Form-item label="模具编码" prop="moduleCode">
                        <i-input v-model="moduleReplacePart.moduleCode" placeholder="模具编码" readonly></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="更换时间" prop="replaceDate">
                        <Date-picker type="datetime" format="yyyy-MM-dd HH:mm" v-model="moduleReplacePart.replaceDate"
                                     placeholder="更换时间"></Date-picker>
                    </Form-item>
                </i-col>
                <i-col span="11" offset="2">
                    <Form-item label="备注信息" prop="remark">
                        <i-input type="textarea" v-model="moduleReplacePart.remark" placeholder="备注信息"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <template v-if="moduleReplacePart.id == (null || '')">
                <Row>
                    <i-col span="24" style="padding: 0px 20px">
                        <Card>
                            <p slot="title">请选择需更换的位置</p>
                            <table id="moldPositionTable"></table>
                        </Card>
                    </i-col>
                </Row>
            </template>
            <template v-else>
                <Row>
                    <i-col span="11">
                        <Form-item label="模具位置" prop="fittingName">
                            <i-input v-model="moduleReplacePart.fittingName"
                                     icon="md-arrow-dropdown-circle" @on-click="getSpare" readonly placeholder="模具位置"></i-input>
                        </Form-item>
                    </i-col>
                    <i-col span="11" offset="2">
                        <Form-item label="位置类型" prop="type">
                            <i-input v-model="moduleReplacePart.type" readonly placeholder="位置类型"></i-input>
                        </Form-item>
                    </i-col>
                </Row>
                <Row>
                    <i-col span="11">
                        <Form-item label="寿命标准" prop="lifeStandard">
                            <i-input v-model="moduleReplacePart.lifeStandard" readonly placeholder="寿命标准"></i-input>
                        </Form-item>
                    </i-col>
                    <i-col span="11" offset="2">
                        <Form-item label="使用次数" prop="useTime">
                            <i-input v-model="moduleReplacePart.useTime" readonly placeholder="使用次数"></i-input>
                        </Form-item>
                    </i-col>
                </Row>
            </template>

            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px">返回</i-button>
                <i-button type="info" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
    <!-- 审核表单区域 -->
    <div id="reviewLayer" style="display: none;">
        <form class="form-horizontal" style="width: 500px;">
            <div class="form-group">
                <div class="form-group">
                    <div class="col-sm-2 control-label">审核状态</div>
                    <div class="col-sm-8" style="margin-top: 6px">
                        <Radio-group v-model="approveParam.status">
                            <Radio :label="1"><span>通过</span></Radio>
                            <Radio :label="2"><span>不通过</span></Radio>
                        </Radio-group>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">备注</div>
                    <div class="col-sm-8" style="margin-top: 6px">
                        <i-input type="textarea" v-model="approveParam.remark" placeholder="审批备注"></i-input>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<script src="${rc.contextPath}/js/module/modulereplacepart.js?_${date.systemTime}"></script>
</body>
</html>
